﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FindArbitrageConsole.ArbitrageFindScenarios;
using FindArbitrageConsole.Data;
using FindArbitrageConsole.Data.Model;
using Microsoft.Practices.Unity;

namespace FindArbitrageConsole
{
    class Program
    {
        private const string _connectionString = "SERVER=localhost;DATABASE=kef_stats;UID=root;PASSWORD=Sql2008";

        static void Main(string[] args)
        {
            /*
            var list = new List<KefData>();
            Console.WriteLine("Press any key to start");
            Console.ReadLine();
            Console.WriteLine("Start...");
            for (int i = 0; i < 100000; i++)
                list.Add(new KefData(8986, 9789, 78978, 789789, 7978, 876.34m, DateTime.Now));
            Console.WriteLine("End");
            Console.ReadLine();
            */

            //RegisterUnity
            var container = new UnityContainer();
            RegisterTypes(container);

            var module = container.Resolve<ArbitrageModule>();
            module.MainScenario();
            module.MainScenario();

        }

        private static void RegisterTypes(IUnityContainer container)
        {
            container.RegisterInstance(typeof(IUnityContainer), container);
            container.RegisterInstance(typeof(IDataService), container.Resolve<DataService>(new ParameterOverride("connectionString", _connectionString)));
            container.RegisterInstance(typeof(ByOneMarketWithAllSelectionsScenario), container.Resolve<ByOneMarketWithAllSelectionsScenario>());
        }
    }
}
